package com.lavender.storage.service.controller;

import com.lavender.storage.service.service.StorageServiceImpl;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StorageController {

    @Autowired
    StorageServiceImpl storageServiceImpl;

    @GetMapping(value = "/deduct")
    public void deduct(@RequestParam String commodityCode, @RequestParam Integer count) {
        System.out.println("storage XID " + RootContext.getXID());
        storageServiceImpl.deduct(commodityCode, count);
    }

}
